<?php

namespace App\Validators;

use Illuminate\Validation\Validator;

class CustomValidator extends Validator {

    //手机号码
    public function validatePhone($attribute, $value, $parameters)
    {
        if($value == null || $value == '')
            return true;
            
        //return $value == 'foo';
        if(!is_numeric($value))
            return false;
        
        if(strlen($value) != 11)
            return false;
            
        return true;
    }
}